/*****************************************************
** Author:
** Date: 2022-01-12
*
*****************************************************/

#ifndef __TM7705_H_
#define __TM7705_H_

#ifdef __cplusplus
extern "C"{
#endif

typedef struct {
    unsigned char (*spi_transfer_byte)(unsigned char val);
    void          (*spi_csn_level)(unsigned char level);
    void          (*reset_level)(unsigned char level);
    unsigned char (*drdy_level)(void);
    void          (*delay_ms)(unsigned int ms);
    void          (*delay_us)(unsigned int us);
} tm7705_obj_t;

int tm7705_set_clk(tm7705_obj_t *obj);
int tm7705_self_cali(tm7705_obj_t *obj);
int tm7705_read_drdy(tm7705_obj_t *obj);
int tm7705_read_adc(tm7705_obj_t *obj, int ch, unsigned short *data);

#ifdef __cplusplus
}
#endif

#endif /* __TM7705_H_ */
